package nrrg.zhujuxing.application.learnscala

object classTest {
  def main(args: Array[String]): Unit = {
    val stu1 = new Student1()
    val stu2 = new Student1(name = "a", 10)
    stu1.Student1()


  }
}

class Student1(){

  var name: String = _
  var age: Int = _

  println("1.主构造方法被调用")

  def this(name:String){
    this()
    println("2. 辅助构造方法1被调用")
    this.name =  name
    println(s"name:$name age:$age")
  }

  def this(name:String, age:Int) {
    this(name)
    println("3. 辅助构造方法2被调用")
    this.age = age
    println(s"name:$name age:$age")
  }

  def Student1(): Unit = {
    println("一般方法被调用")
  }
}